#include <iostream>


class Person {
public:
    int a;
    int b;

public:
    // //利用成员函数重载 左移运算符p.operator<<(cout) 简化版本  p << std::cout;
    /*void operator<<(std::ostream &cout) {
        std::cout << "p" << std::endl;
    }
*/
};

// 只能利用全局函数重载左移运算符
std::ostream &operator<<(std::ostream &cout, Person &p) {
    std::cout << p.b << std::endl;
    return cout;
}

void test01() {
    Person p{};
    p.a = 10;
    p.b = 10;
    std::cout << p << std::endl;
}
int main() {
    test01();
    return 0;
}

